#include <stdio.h>

int main(int argc, char const *argv[])
{
    FILE * fp = fopen("test.txt", "w");
    int num = 10;
    float numf = 3.1415;

    char *str = "hello";
    char buffer[64];
    // 输出到文件
    fprintf(fp, "%d %f %s\n", num, numf, str);
    //输出到字符串缓冲区
    sprintf(buffer, "%d %f %s\n", num, numf, str);
    puts(buffer);
    fclose(fp);
    return 0;
}
